开始打印
[helpstring("method Print")] HRESULT Print([in] DOUBLE dX1, [in] DOUBLE dY1, [in] DOUBLE dX2, [in] DOUBLE dY2, [out,retval] VARIANT_BOOL* pOk);
参数 |
说明 |
[in] DOUBLE dX1 |
打印的范围左下角X1 |
[in] DOUBLE dY1 |
打印的范围左下角Y1 打印的范围右上角Y2 |
[in] DOUBLE dX2 |
打印的范围右上角X2 |
成功返回TRUE
例如: JS ,选择一个范围打印
function Print() { var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint"); getPt.message = "点取打印范围第一点"; if (getPt.go() != 1) { return; } var frstPt = getPt.value(); if (frstPt == null) return; var utl = mxOcx.NewUtility(); var secondPt = utl.GetCorner(frstPt, "点取打印范围第二点"); if (secondPt == null) return; var print = mxOcx.NewComObject("IMxDrawPrint"); if (print.Print(frstPt.x, frstPt.y, secondPt.x, secondPt.y)) { alert("打印成功"); } else { alert("打印失败"); } }
例如: VC COM
void CTestVc2005Dlg::Print() { IMxDrawUiPrPointPtr getPt; getPt.CreateInstance(__uuidof( MxDrawUiPrPoint )); getPt->message = _T("点取打印范围第一点"); if (getPt->go() != 1) { return; } IMxDrawPointPtr frstPt = getPt->value(); if (frstPt == NULL) return; IMxDrawUtilityPtr utl; utl.CreateInstance(__uuidof( MxDrawUtility )); IMxDrawPointPtr secondPt = utl->GetCorner(frstPt, _T("点取打印范围第二点") ); if (secondPt == NULL) return; IMxDrawPrintPtr print; print.CreateInstance(__uuidof( MxDrawPrint )); if (print->Print(frstPt->x, frstPt->y, secondPt->x, secondPt->y)) { AfxMessageBox(_T("打印成功")); } else { AfxMessageBox(_T("打印失败") ); } }